import Home from '../components/Home'
import Detail from '../components/Detail'
import Login from '../components/Login'
import NotFound from '../components/NotFound'
import Child1 from '../components/Child1'
import Child2 from '../components/Child2'
import { Navigate } from 'react-router-dom'
import AuthRoute from './AuthRoute'
// const NotFound = lazy(() => import('../components/NotFound'))



export const routes = [
    {path:'/',element:<Navigate to='/home'/>},
    {
      path:'/home', 
      element:<Home/>,
      children:[
        {path:'/home',element:<Navigate to='/home/child1' />},
        {path:'/home/child1',element:<Child1 />},
        {
          path:'/home/child2',
          element:(
          <AuthRoute>
            <Child2 />
          </AuthRoute>
        )
        }
      ] 
    },
      // 动态路由传参数需要先配置
    {path:'/detail/:id', element:<Detail />},
    {path:'/login', element:<Login />},
    {path:'*',element:<NotFound />}

    
  ]